package com.hspedu.extend_;

public class Base extends TopBase{//父类
    public int n1 = 100;
    protected int n2 = 200;
    int n3 = 300;
    private int n4 = 400;

    public Base() {//无参构造器
        System.out.println("Base()父类的无参构造器....");
    }

    public Base(String name) {//有参构造器1
        System.out.println("Base(String name)父类的有参构造器....");
    }

    public Base(String name, int age) {//有参构造器2
        System.out.println("Base(String name,int age)父类的有参构造器....");
    }

    //父类提供一个public方法，返回n4
    public int get() {
        return n4;
    }
    public void test100() {
        System.out.println("test100");
    }

    protected void test200() {
        System.out.println("test200");
    }

    void test300() {
        System.out.println("test300");
    }

    private void test400() {
        System.out.println("test400");
    }

    //因为test400是private不能被子类调用的，则可以在父类里创建一个公共方法，来调用它
    public void callTest400() {
        test400();
    }
}
